﻿using PC.AzureMultiApp.WebRoleMultiApp.Controllers;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting.Web;
using System.Web.Mvc;
using PC.AzureMultiApp.Core.Models;
using System.Collections.Generic;
using PC.AzureMultiApp.Storage.Moles;
using PC.AzureMultiApp.Storage;
using PC.AzureMultiApp.Core.Moles;
using PC.AzureMultiApp.Core.Applications.Moles;

namespace PC.AzureMultiApp.WebRoleMultiApp.Tests
{
    [TestClass()]
    public class EditControllerTest
    {

        [TestMethod]
        [HostType("Moles")]
        public void EditTest()
        {
            EditController controller = new EditController();

            MApplications.GetByIdString = (id)
             =>
            {
                return new ApplicationModel() { UniqueId = "uniqueId"  };
            };


            ViewResult result = controller.Edit("uniqueId") as ViewResult;
            Assert.IsNotNull(result);
        }

        [TestMethod]
        [HostType("Moles")]
        public void EditValueTest()
        {
            EditController controller = new EditController();

            bool called = false;
            MApplications.EditStringApplicationModel = (a, b)
             =>
            {
                called = true;
            };

            ApplicationModel app = new ApplicationModel();
            app.IsWebDeploy = false;

            ViewResult result = controller.Edit("id", app) as ViewResult;
            Assert.IsTrue(called);
        }

       
    }
}
